package gewu.suleju.dao.iml;

import gewu.suleju.model.pojo.RenterReservation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;

public interface IRenterReservationDao extends JpaRepository<RenterReservation,Integer> {
    RenterReservation findByUserIdAndHouseInforId(Integer userId,Integer houseId);
    @Transactional
    @Modifying
    @Query(value="update renter_reservation set is_status=0 where id=?1",nativeQuery=true)
    void updateStatus(Integer id);

    @Transactional
    @Modifying
    @Query(value="update renter_reservation set is_status=1 where id=?1",nativeQuery=true)
    void updateStatus1(Integer id);

    ArrayList<RenterReservation> findByIsStatus(Integer id);
}
